﻿namespace project_3
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("The prime number from 2 to 100");
            int[] deleted = new int[101];//定义一个删除数组记录，2-100内各数是否应该被删除

            int i = 2;
            while(i<=100)
            {
                if (deleted[i]==1)//若第i个数已经被删除，即不是素数，则i++
                {
                    i++;
                    continue;

                }
                int j = 100;
                  while(j>i)//从100开始检验j是否为素数i的倍数
                {
                    if (j % i == 0)
                        deleted[j] = 1;
                    j--;
                }
                i++;
               }
            for(int k=2;k<=100;k++)
            {
                if (deleted[k]==0)
                {
                    Console.Write(k + " ");
                }
            }
        }
    }
}